#ifndef __ENDIAN_H__
#define __ENDIAN_H__

#ifdef __cplus_plus
extern "C" {
#endif

#include <stdint.h>

#define swap64(value)                                    \
    (                                                    \
    ((((uint64_t) value) >> 56) & 0x00000000000000FF ) | \
    ((((uint64_t) value) >> 40) & 0x000000000000FF00 ) | \
    ((((uint64_t) value) >> 24) & 0x0000000000FF0000 ) | \
    ((((uint64_t) value) >> 8)  & 0x00000000FF000000 ) | \
    ((((uint64_t) value) << 8)  & 0x000000FF00000000 ) | \
    ((((uint64_t) value) << 24) & 0x0000FF0000000000 ) | \
    ((((uint64_t) value) << 40) & 0x00FF000000000000 ) | \
    ((((uint64_t) value) << 56) & 0xFF00000000000000 )   \
    )

#ifdef __cplus_plus
}
#endif

#endif // _ENDIAN_H_
